﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ProjectFinal {
	public partial class frmWelcome : Form {
		public frmWelcome() {
			InitializeComponent();
			dtp_Today.CustomFormat = Constants.DATE_FORMAT;  //Override date format
			BusinessRules.init(DateTime.Now.ToString(Constants.DATE_FORMAT));
		}

		//Intercept event when Closing main form
		protected override void OnClosing(CancelEventArgs e) {
			BusinessRules.saveData(); //Save when exiting
			base.OnClosing(e);
		}

		private void dateTimePicker1_ValueChanged(object sender, EventArgs e) {
			BusinessRules.setToday(dtp_Today.Text);
		}

		private void btn_tomorrow_Click(object sender, EventArgs e) {
			BusinessRules.setToTomorrow();
			dtp_Today.Value = BusinessRules.getTodayDT();
		}

		private void btnCheckIn_Click(object sender, EventArgs e) {
			new frmCheckIn().ShowDialog();
		}

		private void btnCheckOut_Click(object sender, EventArgs e) {
			new frmCheckOut().ShowDialog();
		}

		private void aboutToolStripMenuItem_Click(object sender, EventArgs e) {
			new AboutBox().ShowDialog();
		}

		private void exitToolStripMenuItem_Click(object sender, EventArgs e) {
			this.Close();
		}

		private void btnAdmin_Click(object sender, EventArgs e) {
			new frmAdmin().ShowDialog();
		}

		private void administrationToolStripMenuItem_Click(object sender, EventArgs e) {
			new frmAdmin().ShowDialog();
		}
	}
}
